﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RootfusHostView
{
    /// <summary>
    /// For pin, what sort of a connection is it?
    /// </summary>
    public enum PinConnectionType { PinInfinite, PinSingle };

    /// <summary>
    /// Input or output pin definition.
    /// </summary>
    public abstract class PinDefinition
    {
        /// <summary>
        /// Pin name to be displayed to user. Had better be unique! :-)
        /// </summary>
        public abstract string Name
        {
            get;
        }

        /// <summary>
        /// Returns the connection type
        /// </summary>
        public abstract PinConnectionType ConnectionType
        {
            get;
        }

        /// <summary>
        /// If the names are the same, then we are the same!
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            PinDefinition d = obj as PinDefinition;
            if (d == null)
            {
                return false;
            }
            return d.Name == Name;
        }

        /// <summary>
        /// Get the hash code -- the name must be unique!
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return Name.GetHashCode();
        }
    }
}
